﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UAgentMacStockList.aspx.cs" Inherits="IHISCETeim.Web.MachineSys.UserModel.UAgentMacStockList" %>
<style>
    .UAgentMacStockList_tdspan{ height:22px; line-height:22px; background-color:#FFC96D; border:1px solid #AC6303; padding:0px 3px; margin-right:3px;}
</style>
<script type="text/javascript">
    $(document).ready(function () {
        $(".UAgentMacStockListTree").find("a").dblclick(function () {
            navTab.openTab("UAgentMacStockList", "UserModel/UAgentMacStockList.aspx", { title: "代理商样机库存表", fresh: true, data: { "ShowAgentName": $(this).attr("tname"), "IsInto": $("#UAgentMacStockList_IsInto").attr("checked")} });
        })
    })

    //所有已选中的代理商
    var $selectagentname_UAgentMacStackList = "<%=ShowAgentName %>";
    function UAgentMacStockListTreeCheck() {
        var json = arguments[0], result = "";
        if (json.checked) {
            $(json.items).each(function (i) {
                // result += "<p>name:" + this.name + " value:" + this.value + " text: " + this.text + "</p>";
                $selectagentname_UAgentMacStackList += this.name + ",";
            });
        }
        else {
            $(json.items).each(function (i) {
                $selectagentname_UAgentMacStackList = $selectagentname_UAgentMacStackList.replace(this.name + ",", "");
            });
        }
        $("#UAgentMacStackList_ShowAgentName").val($selectagentname_UAgentMacStackList);
    }
</script>
<form id="pagerForm" method="post" action="UserModel/UAgentMacStockList.aspx">
<input type="hidden" name="IsInto" value="<%=IsInto %>" />
<input type="hidden" name="ShowAgentName" value="<%=ShowAgentName %>" />
<input type="hidden" name="SerialNumber" value="<%=SerialNumber %>" />
<input type="hidden" name="IntoStockDateFrom" value="<%=IntoStockDateFrom %>" />
<input type="hidden" name="IntoStockDateTo" value="<%=IntoStockDateTo %>" />

<input type="hidden" name="orderField" value="<%=orderField %>" />
<input type="hidden" name="orderDirection" value="<%=orderDirection %>" />
<input type="hidden" name="pageNum" value="1" />
<input type="hidden" name="numPerPage" value="<%=numPerPage %>" />
</form>
<form id="form1" runat="server" method="post" action="UserModel/UAgentMacStockList.aspx"
onsubmit="return navTabSearch(this);">
<div class="pageContent">    
    <div class="searchBar">
        <input type="hidden" id="UAgentMacStackList_ShowAgentName" name="ShowAgentName" value="<%=ShowAgentName %>" />
        <table class="searchContent">
            <tr>
                <td>
                    <b>查询条件：</b>
                </td>
                <td>
                    <div class="agentlistdiv">
                        <div class="panelBar" >
                            <ul class="toolBar"  > 
                                <li style=" float:right;"><a href="#" class="closeselectagent delete"><span>确定选择</span></a></li>
                            </ul>
                        </div>                
                        <div class="agentlisttreecon">
                            <ul class="tree treeCheck UAgentMacStockListTree" oncheck="UAgentMacStockListTreeCheck">
                                <%=GetAgentList()%>
                            </ul>
                        </div>
                    </div>
                    <a href="#"  class="openselectagent">选择代理商</a>
                </td>                
                <td>
                    机号:
                </td>
                <td>
                    <input type="text" name="SerialNumber" value="<%=SerialNumber %>" />
                </td>
                <td>
                    入库日期从：
                </td>
                <td >
                   <input name="IntoStockDateFrom" type="text" size=8 value="<%=IntoStockDateFrom %>"  class="date"/>
                </td>
                <td>
                   到：
                </td>
                <td>
                   <input name="IntoStockDateTo" type="text" size=8 value="<%=IntoStockDateTo %>"  class="date"/>
                </td>
                <td>
                    <input type="checkbox" id="UAgentMacStockList_IsInto" name="IsInto" value="True" <%=IsInto?"checked":"" %> />只显示未交机
                </td>
                <td>
                    <div class="subBar">
                        <ul>
                            <li>
                                <div class="buttonActive">
                                    <div class="buttonContent">
                                        <button type="submit">
                                            检索</button></div>
                                </div>
                            </li>
                        </ul>
                    </div>
                </td>
            </tr>                        
        </table>
    </div>
    <div class="panelBar">                    
        <ul class="toolBar">                       
            <%if(HasPower(IHISCETeim.Web.Permission.新增)) {%>
                <li><a class="add" href="UserModel/UAgentMacStockAdd.aspx" target="dialog" title="添加样机" rel="UAgentMacStockAdd" max=false  mask=true  maxable=false  minable=false  resizable=false drawable=true  width="450" height="350"><span>添加</span></a></li>
            <%} %>
            <% if (HasPower(IHISCETeim.Web.Permission.修改))
                {%>
            <li><a class="edit" href="UserModel/UAgentMacStockDetailAdd.aspx?UASID={sid_user}" target="dialog" title="样机定检" rel="UAgentMacStockDetailAdd" max=false  mask=true  maxable=false  minable=false  resizable=true drawable=true  width="800" height="500"><span>定检</span></a></li>
            <%} %>
             <% if (HasPower(IHISCETeim.Web.Permission.修改))
                {%>
            <li><a class="edit" href="UserModel/UAgentMacStockEdit.aspx?UASID={sid_user}" target="dialog" title="修改" rel="UAgentMacStockEdit"  rel="UAgentMacStockAdd" max=false  mask=true  maxable=false  minable=false  resizable=false drawable=true  width="450" height="350"><span>修改</span></a></li>
            <%} %>
            <% if (HasPower(IHISCETeim.Web.Permission.删除))
                {%>
            <li><a class="delete" href="sysAjaxDone.ashx?ajaxmethod=DeleteUAgentMacStockList&UASID={sid_user}" target="ajaxTodo" title="确定要删除吗?"><span>删除</span></a></li>
            <%} %>
            <% if (HasPower(IHISCETeim.Web.Permission.导出))
                {%>
            <li><a class="icon" href="UserModel/ExportExecl/ExportExeclUAgentMacStockList.aspx?orderField=<%=orderField %>&orderDirection=<%=orderDirection %>&IsInto=<%=IsInto %>&SerialNumber=<%=SerialNumber %>&ShowAgentName=<%= Server.UrlEncode(ShowAgentName)%>&IntoStockDateFrom=<%=IntoStockDateFrom %>&IntoStockDateTo=<%=IntoStockDateTo %>" target="_blank" title="确定要导出吗?"><span>导出</span></a></li>
            <%} %>
        </ul>
    </div>
    <asp:repeater id="rpMenu" runat="server">
        <HeaderTemplate>
        <table class="list" width="1200"  layoutH="78">
        <thead>
            <tr  >                   
                <th  orderField="SerialNumber" class="asc" width="85px">
                    机号
                </th>                
               <th width="100">
                    代理商
                </th> 
                <th orderField="IntoStockDate" class="asc" width="110px">
                    入库时间
                </th>
                <th  align="center" width="90px">
                    是否已交机
                </th>
                 <th width="110px">
                    交机时间
                </th>
                <th>工厂中</th>
                <th align="center" width="65px">
                    需点检次数
                </th>
                <th align="center" width="65px">
                    已点检次数
                </th>
                 <th align="center" width="65px">
                    未点检次数
                </th>  
                  <th >
                    
                </th> 
                <th>新机检查</th>
               <%-- <th>检查时间</th>--%>
                     
            </tr>
        </thead>
        <tbody>
        </HeaderTemplate>
        <ItemTemplate>
            <tr target="sid_user" rel="<%# Eval("UASID") %>"> 
				<td>
                <%# Eval("SerialNumber")%>
                </td>
                 <td style=" text-decoration: <%# Convert.ToBoolean(Eval("State"))?"line-through;":"" %>" >
                    <%# Eval("AgentName")%>
                </td>  
				<td><%# Eval("IntoStockDate")%></td>
			
                <td><%# Convert.ToBoolean(Eval("IsInto"))?"是":"<b style='color:red'>否</b >"%></td>
                <td><%# Eval("IntoDate")%></td>
                <td><%# Convert.ToBoolean(Eval("IsInIHISCE")) ? "<b style='color:red'>是</b>" : "否"%></td>
                <td>
                    <%# Eval("d1")%>
                </td>
                 <td>
                    <%# Eval("d2")%>
                </td>
                <td>
                    <%# GetNoSingNum(Eval("d1"), Eval("d2"))%>
                </td>
                 <td></td>
                <td><%# Convert.ToBoolean(Eval("CheckNew")) ? "有" : "<b style='color:red'>否</b >"%></td>
               <%-- <td><%# Eval("CheckNewDate")%></td>--%>
               
			</tr>
        </ItemTemplate>
        <FooterTemplate>
            <tr> 
				<td>
               
                </td>
                 <td>
                    
                </td>  
				<td></td>
			
                <td></td>
                <td></td><td></td>
                <td>
                <%=GetSumDt("d1")%>
                </td>
                 <td>
                <%=GetSumDt("d2")%>
                </td>
                 <td>
              <%=Convert.ToInt32(GetSumDt("d1")) == 0 ? "0" : (Convert.ToInt32(GetSumDt("d1")) - Convert.ToInt32(GetSumDt("d2"))).ToString()%>
                </td>
                 <td>
                 点检完成率为: <%= Convert.ToDouble(GetSumDt("d1"))==0?"100":(Convert.ToDouble(Convert.ToDouble(GetSumDt("d2")) / Convert.ToDouble(GetSumDt("d1"))) * 100).ToString("F2")%>%
                 </td>
                <td></td>
			
             <%--   <td></td>--%>
			</tr>
        </tbody>
    </table>
    </FooterTemplate> 
    </asp:repeater>
    <div class="panelBar">
        <div class="pages">
            <span>显示</span>
            <select class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})">
                <%=SetnumPerPage() %>
            </select>
            <span>条，共<%=TotalCount%>条</span>
        </div>
        <div class="pagination" targettype="navTab" totalcount="<%=TotalCount%>" numperpage="<%=numPerPage %>"
            pagenumshown="10" currentpage="<%=pageNum %>">
        </div>
    </div>
</div>
</form>
